<?php
/**
 *    part view: messages_list
 *    File: support/messages_list.php
 */
        if( count($messages)>0 )
        {
          
//          if( isset($user_from) )
//            $user_from_name = ( $user_from->name!="" )?$user_from->name:$user_from->username;
//          else
//            $user_from_name = "";
          $user_from_name = lang('menu_support');
          //print_r($messages);
          if( $main_image != NULL )            
              $my_image = "<img src='".base_url()."profile/image/thumb/{$user->id}/{$main_image}' alt='{$user->username}'>";            
          else
              $my_image = "<img src='".base_url()."img/no_photo.gif' alt=''>";
          
//          if( $main_from_image != NULL )            
//              $from_image = "<img src='".base_url()."profile/image/thumb/{$user_from->id}/{$main_from_image}' alt='{$user_from->username}'>";            
//          else
//              $from_image = "<img src='".base_url()."img/no_photo.gif' alt=''>";
            $from_image = "<img class='profil' src='".base_url()."img/support_thumb.jpg' alt='". lang('menu_support')."' /> ";
          
            foreach ($messages as $row)
            {
              
               if( $row->from == $user->id ) // Poruka je od logovanog usera
               {
                 echo "
                   
                    <div class='msg'> <!-- My Message -->
                    <div class='msg-right'>
                    <div class='user-name'>
                        <span class='name'>".lang('me')."</span><span class='time'>{$row->time}</span>
                    </div>
                        <p>{$row->content}</p>
                    </div><!--end msg-left-->
                    <div class='baloon-r'></div>
                    <a href='".base_url()."profile.htm'>{$my_image}</a>
                    <div class='clr'></div>
                    </div><!--end msg-->

                 ";
               }
               else
               {                                    
                  echo "
                  
                    <div class='msg'> <!-- Message FROM -->
                    <a href='javascript:void(null)'>{$from_image}</a>
                    <div class='baloon-l'></div><!--end baloon-l-->
                    <div class='msg-left'>
                    <div class='user-name'>
                        <span class='name'>{$user_from_name}</span><span class='time'>{$row->time}</span>
                    </div>
                        <p>{$row->content}</p>
                    </div><!--end msg-left-->
                    <div class='clr'></div>
                    </div><!--end msg-->

                  ";
                  
                }
              
            }          
          
        }
 ?>
